<!DOCTYPE html>
<html>
<head>
    <title>登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <meta name="keywords" content="Flat Dark Web Login Form Responsive Templates, Iphone Widget Template, Smartphone login forms,Login form, Widget Template, Responsive Templates, a Ipad 404 Templates, Flat Responsive Templates" />
    <link href="/css/style.css" rel='stylesheet' type='text/css' />
</head>

<body>
<h1>个人后台登录</h1>
<div class="login-form">
    <div class="close"> </div>
    <div class="head-info">
        <label class="lbl-1"> </label>
        <label class="lbl-2"> </label>
        <label class="lbl-3"> </label>
    </div>
    <div class="clear"> </div>
    <div class="avtar">
        <img src="/images/avtar.png" />
    </div>
        <input type="text" id="userdata" class="text" value="Username" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Username';}" >
        <div class="key">
        <input type="password" id="pwd" value="Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">
        </div>
        <div class="signin" id="submit">
            <input class="submit" type="submit" value="Login" >
        </div>
</div>
<div class="copy-rights">
<!--    <p>Copyright &copy; 2015.Company name All rights reserved.More Templates <a href="http://www.cssmoban.com/" target="_blank" title="1">1</a> - Collect from <a href="http://www.cssmoban.com/" title="2" target="_blank">2</a></p>-->
<!--<p>请登陆</p>-->
</div>

</body>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script>
    $('#submit').on('click',function () {
        var userdata = $('#userdata').val();
        var pwd = $('#pwd').val();
        if(userdata == 'Userdata' || pwd == 'Password' ){
            alert("账号密码不可为空");
        }else{
            $.ajax({
                type: "GET",
                url: "/login/login",
                data: {username:userdata, pwd:pwd},
                dataType: "json",
                success: function(data){
                    if(data.code == 200){
                        window.location.href="/index";
                    }else{
                        alert(data.message);
                    }
                }
            });
        }
    });
</script>
</html>